home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / Macintosh Programmer’s Workshop / MPW 3.1 / MPW / Interfaces / CIncludes / Printing.h < prev    next >
Text File  |  1990-12-13  |  9KB  |  309 lines

  1. /************************************************************
  2.  
  3. Created: Thursday, September 7, 1989 at 5:35 PM
  4.     Printing.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.     Copyright Apple Computer, Inc.    1985-1989
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PRINTING__
  15. #define __PRINTING__
  16.  
  17. #ifndef __QUICKDRAW__
  18. #include <Quickdraw.h>
  19. #endif
  20.  
  21. #ifndef __DIALOGS__
  22. #include <Dialogs.h>
  23. #endif
  24.  
  25. #define iPFMaxPgs 128
  26. #define iPrPgFract 120                /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  27. #define iPrPgFst 1                    /*Page range constants*/
  28. #define iPrPgMax 9999
  29. #define iPrRelease 3                /*Current version number of the code.*/
  30. #define iPrSavPFil -1
  31. #define iPrAbort 0x0080
  32. #define iPrDevCtl 7                 /*The PrDevCtl Proc's ctl number*/
  33. #define lPrReset 0x00010000         /*The PrDevCtl Proc's CParam for reset*/
  34. #define lPrLineFeed 0x00030000
  35. #define lPrLFStd 0x0003FFFF         /*The PrDevCtl Proc's CParam for std paper advance*/
  36. #define lPrLFSixth 0x0003FFFF
  37. #define lPrPageEnd 0x00020000        /*The PrDevCtl Proc's CParam for end page*/
  38. #define lPrDocOpen 0x00010000
  39. #define lPrPageOpen 0x00040000
  40. #define lPrPageClose 0x00020000
  41. #define lPrDocClose 0x00050000
  42. #define iFMgrCtl 8                    /*The FMgr's Tail-hook Proc's ctl number*/
  43. #define iMemFullErr -108
  44. #define iIOAbort -27
  45. #define pPrGlobals 0x00000944        /*The PrVars lo mem area:*/
  46. #define bDraftLoop 0
  47. #define bSpoolLoop 1
  48. #define bUser1Loop 2
  49. #define bUser2Loop 3
  50. #define iPrBitsCtl 4
  51. #define lScreenBits 0
  52. #define lPaintBits 1
  53. #define lHiScreenBits 0x00000002    /*The Bitmap Print Proc's Screen Bitmap param*/
  54. #define lHiPaintBits 0x00000003     /*The Bitmap Print Proc's Paint [sq pix] param*/
  55. #define iPrIOCtl 5
  56. #define iPrEvtCtl 6                 /*The PrEvent Proc's ctl number*/
  57. #define lPrEvtAll 0x0002FFFD        /*The PrEvent Proc's CParam for the entire screen*/
  58. #define lPrEvtTop 0x0001FFFD        /*The PrEvent Proc's CParam for the top folder*/
  59. #define sPrDrvr ".Print"
  60. #define iPrDrvrRef -3
  61. #define getRslDataOp 4
  62. #define setRslOp 5
  63. #define draftBitsOp 6
  64. #define noDraftBitsOp 7
  65. #define getRotnOp 8
  66. #define NoSuchRsl 1
  67. #define RgType1 1
  68.  
  69. enum {feedCut,feedFanfold,feedMechCut,feedOther};
  70. typedef unsigned char TFeed;
  71.  
  72. enum {scanTB,scanBT,scanLR,scanRL};
  73. typedef unsigned char TScan;
  74.  
  75. typedef Rect *TPRect;
  76.  
  77. typedef pascal void (*PrIdleProcPtr)(void);
  78. typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
  79.  
  80. struct TPrPort {
  81.     GrafPort gPort;                 /*The Printer's graf port.*/
  82.     QDProcs gProcs;                 /*..and its procs*/
  83.     long lGParam1;                    /*16 bytes for private parameter storage.*/
  84.     long lGParam2;
  85.     long lGParam3;
  86.     long lGParam4;
  87.     Boolean fOurPtr;                /*Whether the PrPort allocation was done by us.*/
  88.     Boolean fOurBits;                /*Whether the BitMap allocation was done by us.*/
  89. };
  90.  
  91. typedef struct TPrPort TPrPort;
  92. typedef TPrPort *TPPrPort;
  93.  
  94. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  95. This is the "PrPeek" record. */
  96. struct TPrInfo {
  97.     short iDev;                     /*Font mgr/QuickDraw device code*/
  98.     short iVRes;                    /*Resolution of device, in device coordinates*/
  99.     short iHRes;                    /*..note: V before H => compatable with Point.*/
  100.     Rect rPage;                     /*The page (printable) rectangle in device coordinates.*/
  101. };
  102.  
  103. typedef struct TPrInfo TPrInfo;
  104. typedef TPrInfo *TPPrInfo;
  105.  
  106. /* Print Info Record: The parameters needed for page composition. */
  107. struct TPrStl {
  108.     short wDev;
  109.     short iPageV;
  110.     short iPageH;
  111.     char bPort;
  112.     TFeed feed;
  113. };
  114.  
  115. typedef struct TPrStl TPrStl;
  116. typedef TPrStl *TPPrStl;
  117.  
  118. struct TPrXInfo {
  119.     short iRowBytes;
  120.     short iBandV;
  121.     short iBandH;
  122.     short iDevBytes;
  123.     short iBands;
  124.     char bPatScale;
  125.     char bUlThick;
  126.     char bUlOffset;
  127.     char bUlShadow;
  128.     TScan scan;
  129.     char bXInfoX;
  130. };
  131.  
  132. typedef struct TPrXInfo TPrXInfo;
  133. typedef TPrXInfo *TPPrXInfo;
  134.  
  135. struct TPrJob {
  136.     short iFstPage;                 /*Page Range.*/
  137.     short iLstPage;
  138.     short iCopies;                    /*No. copies.*/
  139.     char bJDocLoop;                 /*The Doc style: Draft, Spool, .., and ..*/
  140.     Boolean fFromUsr;                /*Printing from an User's App (not PrApp) flag*/
  141.     PrIdleProcPtr pIdleProc;        /*The Proc called while waiting on IO etc.*/
  142.     StringPtr pFileName;            /*Spool File Name: NIL for default.*/
  143.     short iFileVol;                 /*Spool File vol, set to 0 initially*/
  144.     char bFileVers;                 /*Spool File version, set to 0 initially*/
  145.     char bJobX;                     /*An eXtra byte.*/
  146. };
  147.  
  148. typedef struct TPrJob TPrJob;
  149. typedef TPrJob *TPPrJob;
  150.  
  151. /* Print Job: Print "form" for a single print request. */
  152. struct TPrint {
  153.     short iPrVersion;                /*(2) Printing software version*/
  154.     TPrInfo prInfo;                 /*(14) the PrInfo data associated with the current style.*/
  155.     Rect rPaper;                    /*(8) The paper rectangle [offset from rPage]*/
  156.     TPrStl prStl;                    /*(8)  This print request's style.*/
  157.     TPrInfo prInfoPT;                /*(14)    Print Time Imaging metrics*/
  158.     TPrXInfo prXInfo;                /*(16)    Print-time (expanded) Print info record.*/
  159.     TPrJob prJob;                    /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  160.     short printX[19];                /*Spare to fill to 120 bytes!*/
  161. };
  162.  
  163. typedef struct TPrint TPrint;
  164. typedef TPrint *TPPrint, **THPrint;
  165.  
  166. /* The universal 120 byte printing record */
  167. struct TPrStatus {
  168.     short iTotPages;                /*Total pages in Print File.*/
  169.     short iCurPage;                 /*Current page number*/
  170.     short iTotCopies;                /*Total copies requested*/
  171.     short iCurCopy;                 /*Current copy number*/
  172.     short iTotBands;                /*Total bands per page.*/
  173.     short iCurBand;                 /*Current band number*/
  174.     Boolean fPgDirty;                /*True if current page has been written to.*/
  175.     Boolean fImaging;                /*Set while in band's DrawPic call.*/
  176.     THPrint hPrint;                 /*Handle to the active Printer record*/
  177.     TPPrPort pPrPort;                /*Ptr to the active PrPort*/
  178.     PicHandle hPic;                 /*Handle to the active Picture*/
  179. };
  180.  
  181. typedef struct TPrStatus TPrStatus;
  182. typedef TPrStatus *TPPrStatus;
  183.  
  184. /* Print Status: Print information during printing. */
  185. struct TPfPgDir {
  186.     short iPages;
  187.     long iPgPos[129];                /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  188. };
  189.  
  190. typedef struct TPfPgDir TPfPgDir;
  191. typedef TPfPgDir *TPPfPgDir, **THPfPgDir;
  192.  
  193. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  194. struct TPrDlg {
  195.     DialogRecord Dlg;                /*The Dialog window*/
  196.     ModalFilterProcPtr pFltrProc;    /*The Filter Proc.*/
  197.     PItemProcPtr pItemProc;         /*The Item evaluating proc.*/
  198.     THPrint hPrintUsr;                /*The user's print record.*/
  199.     Boolean fDoIt;
  200.     Boolean fDone;
  201.     long lUser1;                    /*Four longs for user's to hang global data.*/
  202.     long lUser2;                    /*...Plus more stuff needed by the particular printing dialog.*/
  203.     long lUser3;
  204.     long lUser4;
  205. };
  206.  
  207. typedef struct TPrDlg TPrDlg;
  208. typedef TPrDlg *TPPrDlg;
  209.  
  210. typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
  211.  
  212. /* This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  213. Print Dialog: The Dialog Stream object. */
  214.  
  215.  
  216. struct TGnlData {
  217.     short iOpCode;
  218.     short iError;
  219.     long lReserved;                 /*more fields here depending on call*/
  220. };
  221.  
  222. typedef struct TGnlData TGnlData;
  223. struct TRslRg {
  224.     short iMin;
  225.     short iMax;
  226. };
  227.  
  228. typedef struct TRslRg TRslRg;
  229. struct TRslRec {
  230.     short iXRsl;
  231.     short iYRsl;
  232. };
  233.  
  234. typedef struct TRslRec TRslRec;
  235. struct TGetRslBlk {
  236.     short iOpCode;
  237.     short iError;
  238.     long lReserved;
  239.     short iRgType;
  240.     TRslRg xRslRg;
  241.     TRslRg yRslRg;
  242.     short iRslRecCnt;
  243.     TRslRec rgRslRec[27];
  244. };
  245.  
  246. typedef struct TGetRslBlk TGetRslBlk;
  247. struct TSetRslBlk {
  248.     short iOpCode;
  249.     short iError;
  250.     long lReserved;
  251.     THPrint hPrint;
  252.     short iXRsl;
  253.     short iYRsl;
  254. };
  255.  
  256. typedef struct TSetRslBlk TSetRslBlk;
  257. struct TDftBitsBlk {
  258.     short iOpCode;
  259.     short iError;
  260.     long lReserved;
  261.     THPrint hPrint;
  262. };
  263.  
  264. typedef struct TDftBitsBlk TDftBitsBlk;
  265. struct TGetRotnBlk {
  266.     short iOpCode;
  267.     short iError;
  268.     long lReserved;
  269.     THPrint hPrint;
  270.     Boolean fLandscape;
  271.     char bXtra;
  272. };
  273.  
  274. typedef struct TGetRotnBlk TGetRotnBlk;
  275. #ifdef __cplusplus
  276. extern "C" {
  277. #endif
  278. pascal void PrPurge(void);
  279. pascal void PrNoPurge(void);
  280. pascal void PrOpen(void);
  281. pascal void PrClose(void);
  282. pascal void PrintDefault(THPrint hPrint);
  283. pascal Boolean PrValidate(THPrint hPrint);
  284. pascal Boolean PrStlDialog(THPrint hPrint); 
  285. pascal Boolean PrJobDialog(THPrint hPrint); 
  286. pascal TPPrDlg PrStlInit(THPrint hPrint);
  287. pascal TPPrDlg PrJobInit(THPrint hPrint);
  288. pascal void PrJobMerge(THPrint hPrintSrc,THPrint hPrintDst);
  289. pascal Boolean PrDlgMain(THPrint hPrint,PDlgInitProcPtr pDlgInit);
  290. pascal TPPrPort PrOpenDoc(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf);
  291. pascal void PrCloseDoc(TPPrPort pPrPort);
  292. pascal void PrOpenPage(TPPrPort pPrPort,TPRect pPageFrame); 
  293. pascal void PrClosePage(TPPrPort pPrPort);
  294. pascal void PrPicFile(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf,Ptr pDevBuf,
  295.     TPrStatus *prStatus);
  296. pascal short PrError(void); 
  297. pascal void PrSetError(short iErr); 
  298. pascal void PrGeneral(Ptr pData);
  299. pascal void PrDrvrOpen(void);
  300. pascal void PrDrvrClose(void);
  301. pascal void PrCtlCall(short iWhichCtl,long lParam1,long lParam2,long lParam3);
  302. pascal Handle PrDrvrDCE(void);
  303. pascal short PrDrvrVers(void);
  304. #ifdef __cplusplus
  305. }
  306. #endif
  307.  
  308. #endif
  309.